const express = require("express")
const model = require("../db/model")
const router = express.Router()
router.post("/addTodo",async (req,res)=>{
    const { todoName } = req.body
    try{
        await model.create( {todoName} )
        const result = await model.find()
        res.send({success: true,msg: "创建成功", data: result})
    }catch(err){
        console.log(err)
        res.send({success: true, msg: "创建失败，请稍后再试"})
    }
    
})
module.exports = router